<?php
namespace Admin\Controller;
class SortlistController extends BaseController {
    public function index(){
        $Sortlist =  M('cate');
        $data = I('post.');
        $offset = ($data['page'] - 1) * $data['rows'];
        $rs = $Sortlist->select();
        $this->assign('Rs',$rs);
        $this->display();
    }
    public function Dell(){
        $Sortlist =  M('cate');
        $data = I('post.');
        $rs = $Sortlist->delete($data['id']);
        if(!empty($rs)){
            $array = array('status'=>"1",'info'=>"删除成功",'url'=>U('Sortlist/index'));
        }else{
            $array = array('status'=>"0",'info'=>"删除失败",'url'=>U('Sortlist/index'));
        }
        $this->ajaxReturn($array);
    }
    public function xiugai(){
        $Sortlist =  M('cate');
        $data = I('get.');
        $rs = $Sortlist->where($data)->select();
        if (!empty($rs)){
            $this->assign('rs',$rs);
        }
        $this->display();
    }
    public function doXiugai(){
        $Sortlist =  M('cate');
        $data = I('post.');
        $rs = $Sortlist->save($data);
        if(!empty($rs)){
            $array = array('status'=>"1",'info'=>"修改成功",'url'=>U('Sortlist/index'));
        }else{
            $array = array('status'=>"0",'info'=>"修改失败",'url'=>U('Sortlist/index'));
        }
        $this->ajaxReturn($array);
    }
}